<?php

use Illuminate\Database\Migrations\Migration;
use Illuminate\Database\Schema\Blueprint;
use Illuminate\Support\Facades\Schema;

class CreateCashDrawsTable extends Migration
{
    /**
     * Run the migrations.
     *
     * @return void
     */
    public function up()
    {
        Schema::create('cash_draws', function (Blueprint $table) {
            $table->id();
            $table->unsignedBigInteger('user_id')->comment('提现用户')->index();
            $table->unsignedBigInteger('merchant_id')->comment('提现商户ID')->index();
            $table->unsignedBigInteger('cash_info_id')->comment('提现信息ID');
            $table->string('status')->default('')->comment('提现状态');
            $table->string('cash_type')->comment('提现类型');
            $table->string('realname')->nullable()->comment('真实姓名');
            $table->string('account')->nullable()->comment('提现账号');
            $table->decimal('amount')->default(0)->comment('提现金额');
            $table->string('remark')->nullable()->comment('提现备注');
            $table->timestamp('paid_at')->nullable()->comment('打款时间');
            $table->string('trade_no')->comment('提现流水号');
            $table->timestamps();
        });
    }

    /**
     * Reverse the migrations.
     *
     * @return void
     */
    public function down()
    {
        Schema::dropIfExists('cash_draws');
    }
}
